<template>
	<div class="yellow">
		<div class="header flex a-center jlr">
			<div class="back" @click="back"><i class="iconfont icon-arrow-left-copy"></i></div>
			<h2>订单评价</h2>
			<div class="back">&nbsp;</div>
		</div>
		<div class="abox">
			<div class="ordermsg">
				<div class="msgbox" style="height: 80vh;">
					<div class="title">打个分吧~</div>
					<div class="flex a-center j-center rate">
						<van-rate  v-model="obj.evalStars" :size="30" color="#fe7537" void-icon="star" void-color="#eee" readonly/>
					</div>					
					<div class="title" style="padding: 0.25rem 0px;">夸夸商品吧~</div>					
					<div class="tagbox">
						<div class="item" v-for="(v,i) in tagList" :key="v.tagId" :class="{'on':v.s}">{{v.tagName}}</div>
					</div>
					
					<div class="context">
						<textarea placeholder="请输入评论" v-model="obj.evaLDesc" readonly></textarea>
						<div class="imggroup">
							<div class="item" v-for="(v,i) in obj.picUrlList" :key="v">
								<img :src="v.picUrl">
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
export default {
	data(){
		return {
			obj:{},
			value:0,
			tagList:[]
		}
	},
	activated() {
		this.initInfo()
	},
	methods:{
		init(){
			var that = this
			this.$ajax.getTgaByProductId({productId:this.$route.query.productId}).then(res=>{
				if(res.code==0){					
					var tagarr = res.data.tagList.map(el=>{
						if(that.obj.tagList&&that.obj.tagList instanceof Array){
							if(that.obj.tagList.find(f=>f.tagId==el.tagId)){
								return {...el,s:true}
							}else{
								return {...el,s:false}
							}
						}else{
							return el
						}
					})					
					
					this.tagList = tagarr					
				}
			})
		},
		initInfo(){
			this.$ajax.selectOrderEvaluateByMemberId({orderId:this.$route.query.id}).then(res=>{
				this.obj = res.data
				console.log(this.obj)
				this.init()
			})
		},
		back(){
			this.$router.go(-1)
		}
	}
}
</script>